<template>
        <div class="div" ref="div">
            111
        </div>
</template>
    
<script setup lang='ts'>
import * as echarts from 'echarts';
import {defineProps,onMounted,ref,watch} from 'vue'
    const {option}=defineProps(['option'])
    let div=ref()
    let myChart
    onMounted(()=>{
        console.log(div.value,'div')
        myChart=echarts.init(div.value)
        myChart.setOption(option)
    })
    watch(option,()=>{
        myChart.setOption(option)
    })
     window.addEventListener('resize', function() {
        if(myChart){
            myChart.resize();
        } 
  });
</script>
    
<style scoped lang="scss">
    .div{
        width: 100%;
        height: 100%;
        // background-color: plum;
    }
</style>